package com.z1.core.utils;

import org.apache.commons.codec.digest.DigestUtils;

import com.z1.core.exception.Z1Exception;

public class VerifyFieldUtils implements VerifyFieldUtilsConst {

	public static String getVerifyField(Object ... objs) {
		StringBuffer buffer = new StringBuffer();
		for (Object obj : objs) {
			if(null == obj || String.valueOf(obj).equals("")) {
				continue;
			}
			if (buffer.length() > 0) {
				buffer.append(VERIFY_FIELD_SEPARATOR);
			}
			buffer.append(null == obj ? "" : String.valueOf(obj));
 		}
		try {
			return DigestUtils.md5Hex(buffer.toString().getBytes("UTF-8"));
		}
		catch (Throwable e) {
			throw new Z1Exception(e);
		}
	}
	
}
